<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'

const { locale } = useI18n()
const helpMdPath = `https://platform-cert.s3.cn-northwest-1.amazonaws.com.cn/markdown/dev/${locale.value}/help.md`

const mdContent = ref<string>()

onMounted(() => {
  const xhr = new XMLHttpRequest()
  xhr.open('get', helpMdPath)
  xhr.onload = () => {
    if (xhr.status == 200) {
      console.log(xhr.responseText)
      mdContent.value = xhr.responseText
    }
  }
  xhr.send()
})
</script>

<template>
  <div id="help" class="text-gray-600 bg-white">
    <div class="w-full mt-12.5">
      <article class="p-5 m-auto border-gray-300 w-300">
        <v-md-preview :text="mdContent" />
      </article>
    </div>
  </div>
</template>

<style lang="scss" scoped>
h2 {
  font-size: 28px;
  border-bottom: 1px #e6e6e6 solid;
  text-align: center;
  padding: 10px 0;
  font-weight: normal;
}

h3 {
  font-size: 22px;
}

img {
  width: 980px;
  height: 430px;
  margin: 0 auto;
  box-shadow: 5px 5px 5px darkgrey;
  border: 2px #e6e6e6 solid;
}

p {
  margin: 10px 0 15px 0;
  text-indent: 25px;
  font-size: 18px;
}
</style>
